/**
 * 编辑设备保养
 * author Forjune
 */
import React, { useEffect } from 'react'
import Plan  from '../components/plan'
import { connect } from 'dva'
import KeepAlive from 'react-activation'

function Edit(props) {
  const { dispatch, location: { query: { id } }, commonAction: { catchObj } } = props
  useEffect(() => {
    dispatch({
      type: 'commonAction/uploadCatch',
      payload: {
        catchObj: {
          deviceCali_edit: [true, false]
        }
      }
    })
  },[dispatch])
  return (
    <KeepAlive name='deviceCali_edit' when={catchObj.deviceCali_edit}>
      <div className="deviceCali_edit">
        <Plan id={id}/>
      </div>
    </KeepAlive>
  )
}

export default connect(({commonAction}) => ({
  commonAction
}))(Edit)